Auto Post for Bloger

Tips & Tricks: Auto Post on Blogspot Using ChatGPT (Fully Automated)

Imagine never having to log into your Blogger dashboard again just to click “New Post.” With a little help from ChatGPT and Google Apps Script, you can create a system that automatically writes and publishes blog posts for you — every day, on autopilot.


💡 How It Works

The idea is simple: Google Apps Script sends a request to ChatGPT’s API to generate an article, then instantly publishes that text to your Blogger blog through the Blogger API. You can set it to run daily, weekly, or whenever you like.


🧩 What You’ll Need

  • A Google account
  • A Blogger blog (of course!)
  • An OpenAI API key (from platform.openai.com)
  • Your Blog ID (found in your Blogger dashboard URL)

⚙️ The Auto Post Script

Here’s the full code that connects ChatGPT directly to Blogspot. You can run it on your phone through Google Apps Script by visiting https://script.google.com in Chrome.

function autoPostFromChatGPT() {
  const blogId = "YOUR_BLOG_ID_HERE"; // Replace with your Blog ID
  const openAIKey = "YOUR_OPENAI_API_KEY"; // Replace with your API Key

  // Step 1: Ask ChatGPT for a blog topic and article
  const topicPrompt = "Generate a random blog topic about blogging tips, SEO, or online content ideas.";
  const topicResponse = UrlFetchApp.fetch("https://api.openai.com/v1/chat/completions", {
    method: "post",
    headers: {
      "Authorization": "Bearer " + openAIKey,
      "Content-Type": "application/json"
    },
    payload: JSON.stringify({
      model: "gpt-3.5-turbo",
      messages: [{ role: "user", content: topicPrompt }]
    })
  });
  const topic = JSON.parse(topicResponse.getContentText()).choices[0].message.content.trim();

  // Step 2: Generate the full blog article
  const articlePrompt = "Write a 400-word blog post titled '" + topic + "' in a friendly, helpful tone with HTML formatting for Blogspot.";
  const articleResponse = UrlFetchApp.fetch("https://api.openai.com/v1/chat/completions", {
    method: "post",
    headers: {
      "Authorization": "Bearer " + openAIKey,
      "Content-Type": "application/json"
    },
    payload: JSON.stringify({
      model: "gpt-3.5-turbo",
      messages: [{ role: "user", content: articlePrompt }]
    })
  });

  const article = JSON.parse(articleResponse.getContentText()).choices[0].message.content;

  // Step 3: Publish directly to Blogger
  const postData = {
    title: topic,
    content: article
  };

  UrlFetchApp.fetch("https://www.googleapis.com/blogger/v3/blogs/" + blogId + "/posts/", {
    method: "post",
    contentType: "application/json",
    headers: { Authorization: "Bearer " + ScriptApp.getOAuthToken() },
    payload: JSON.stringify(postData)
  });
}

📅 Automate It

After saving your script, tap the clock icon ⏰ in the Google Apps Script editor. Add a trigger to run autoPostFromChatGPT daily, weekly, or however often you want new content.


✨ Result

Once set up, ChatGPT will:

  1. Think of a new topic automatically.
  2. Write the full article with HTML formatting.
  3. Publish it instantly to your Blogspot blog.

All without you typing a single word.


🚀 Final Thoughts

With this setup, your blog stays alive 24/7 — fresh content, consistent SEO activity, and no manual work. The more creative your ChatGPT prompts, the smarter and more personal your blog posts will feel.

Try it today, and let your blog start writing itself.

Komentar

Postingan populer dari blog ini

Android Tips, Hidden Features

Instagram Tips, How to download video